/**
 * Created by zhaoxk on 2016/11/4.
 */
import React from 'react';
import {Icon} from 'antd';
export default class ToolBar extends React.Component {
    toolEvent(type) {
        this.props.toolEvent(type);
    }

    remarkBtn() {
        const hasRemark = this.props.hasRemark;
        if (hasRemark) {
            return (
                <span
                    onClick={this.toolEvent.bind(this, 'delRM')}
                >
                    <Icon type="minus-circle-o"/>
                    <b>删备注</b>
                </span>
            );
        }
        return (
            <span
                onClick={this.toolEvent.bind(this, 'addRM')}
            >
                <Icon type="plus-circle-o"/>
                <b>加备注</b>
            </span>
        );
    }

    render() {
        const className = `toolBar ${this.props.className || ''}`;
        return (
            <div
                className={className}
            >
                <div>
                    <span
                        onClick={this.toolEvent.bind(this, 'remove')}
                    >
                        <Icon type="delete"/>
                        <b>删除</b>
                    </span>
                    <span
                        onClick={this.toolEvent.bind(this, 'addImg')}
                    >
                        <Icon type="picture"/>
                        <b>图片</b>
                    </span>
                    {this.remarkBtn()}
                </div>
            </div>
        );
    }
}
